Fix read_cr3() and use it.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Mon, 20 Feb 2006 17:34:21 +0000 (17:34 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Mon, 20 Feb 2006 17:34:21 +0000 (17:34 +0000)
From: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h

index 5465e26d1c87252996a85242388d5fba1d7df062..dfd2f2df0fdf787d4f4abf1fded10dfd35bef5c2 100644 (file)
@@ -152,10 +152,7 @@ void dump_pagetable(unsigned long address)
        pmd_t *pmd;
        pte_t *pte;
 
-       asm("movq %%cr3,%0" : "=r" (pgd));
-       pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
-
-       pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); 
+       pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
        pgd += pgd_index(address);
        if (bad_address(pgd)) goto bad;
        printk("PGD %lx ", pgd_val(*pgd));
@@ -261,9 +258,7 @@ static int vmalloc_fault(unsigned long address)
 
        /* On Xen the line below does not always work. Needs investigating! */
        /*pgd = pgd_offset(current->mm ?: &init_mm, address);*/
-       asm("movq %%cr3,%0" : "=r" (pgd));
-       pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
-       pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
+       pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
        pgd += pgd_index(address);
        pgd_ref = pgd_offset_k(address);
        if (pgd_none(*pgd_ref))
index 90104415546a1f6f7332c98ff1e4c104b627208e..bde56ce43c13f3a82851d9d161b89d328995f552 100644 (file)
@@ -182,7 +182,7 @@ static inline void write_cr0(unsigned long val)
 #define read_cr3() ({ \
        unsigned long __dummy; \
        asm("movq %%cr3,%0" : "=r" (__dummy)); \
-       return machine_to_phys(__dummy); \
+       machine_to_phys(__dummy); \
 })
 
 static inline unsigned long read_cr4(void)